package com.huike.web.controller.clues;

import java.util.List;

import com.huike.clues.domain.ClueTrackRecordDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.annotation.Log;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.page.TableDataInfo;
import com.huike.common.enums.BusinessType;
import com.huike.common.utils.DateUtils;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 线索跟进记录Controller
 * @date 2021-04-22
 */
@RestController
@RequestMapping("/clues/record")
public class TbClueTrackRecordController extends BaseController {

    @Autowired
    ITbClueTrackRecordService iTbClueTrackRecordService;

    /**
     * 查询线索跟进记录列表
     */
    @PreAuthorize("@ss.hasPermi('clues:record:list')")
    @GetMapping("/list")
    public TableDataInfo list(@RequestParam("clueId")Long clueId) {
        TableDataInfo result = iTbClueTrackRecordService.findByList(clueId);
       return result;
    }

    @Autowired
    private ITbClueTrackRecordService tbClueTrackRecordService;

    /**
     * 添加跟进记录
     * @return
     */
    @PostMapping
    public AjaxResult addRecord(@RequestBody ClueTrackRecordVo clueTrackRecordVo) {
        tbClueTrackRecordService.addRecord(clueTrackRecordVo);
        return AjaxResult.success("新增成功");
    }

    /**
     * 查询线索跟进记录列表
     * @param clueId
     * @return
     */
    // @GetMapping("/list")
    // public ClueTrackRecordDto list(Long clueId) {
    //     return tbClueTrackRecordService.list(clueId);
    // }

}